|
|
 |
|
|
|
|
Exit Sub
End If
num_entries = GetPaletteEntries( _
picCanvas.Picture.hPal, 0, 256, palentry(0))
' Save the color of pixel (0, 0). orig_color = picCanvas.Point(0, 0)
txt = "Log Sys Red Green Blue" & vbCrLf
For i = 0 To num_entries - 1 ' See to what system entry each logical
' palette entry is mapped. picCanvas.PSet (0, 0), i + PALETTE_INDEX
GetBitmapBits picCanvas.Image, 1, pixel
' Add the information to the string. txt = txt & _
Format$(i, "@@@") & _
Format$(pixel, "@@@@") & _
Format$(palentry(i).peRed, "@@@@@") & _
Format$(palentry(i).peGreen, "@@@@@@") & _
Format$(palentry(i).peBlue, "@@@@@") & _
vbCrLf
Next i
' Restore pixel (0, 0) to its original color. picCanvas.PSet (0, 0), orig_color
txtPositions.Text = txt
End Sub |
|
|
|
|
|
|
|
|
Example program SysMap, shown in Figure 3.11, uses this subroutine to display the mapping between a logical palette and the system palette. Select Open from the File menu to load an image. For each of the colors in the image's logical palette, the program displays the color's logical and system palette indexes and its red, green, and blue components. |
|
|
|
|
|
|
|
|
Specifying System Palette Placement |
|
|
|
|
|
|
|
|
Although you cannot tell the system where to place a color in the system palette, you can use the palette mapping rules to make colors land in the positions you want. Start by using SetPaletteEntries to map the static colors to their normal locations. Use the GetSystemPaletteEntries function to determine the color values the system static colors should have. Map the first half of the static colors into the beginning of the color palette. Map the remaining static colors into the end of the color palette. |
|
|
|
|
|
|
|
|
Initially, make all the non-static palette entries black and set their flags to PC_NOCOLLAPSE. These entries would normally map to the static color black, which always |
|
|
|
|
|